// 如果没有通过拦截器配置域名的话，可以在这里写上完整的URL(加上域名部分)
let hotSearchUrl = '/ebapi/store_api/hot_search';

//let loginUrl = '/api/user/login'; //登录
//let loginUrl = 'tblmerchantuser/tbl-merchant-user/login';//登录
//let addGoodInfo = 'tblmerchantgoods/tbl-merchant-goods/addGoodInfo';//添加商品信息
//let loginUrl = 'tblmerchantuser/tbl-merchant-user/login';//登录

// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	// 此处没有使用传入的params参数
	// let getSearch = (params = {}) => vm.$u.get(hotSearchUrl, {
	// 	id: 2
	// });
	// 此处使用了传入的params参数，一切自定义即可
	//let getInfo = (params = {}) => vm.$u.post(indexUrl, params);
	 let arr={}
	 
	 //01
		 arr.caiCateList = (params = {}) => vm.$u.post("/api/farm/caiCateList", params);//商品分类信息获取
		 //02
		 arr.caiList = (params = {}) => vm.$u.post("/api/farm/caiList", params);//商品分类信息下商品信息
		 //03
		 arr.send = (params = {}) => vm.$u.post("/api/Sms/send", params);//发送短信验证码
		 //04
		 arr.mobilelogin = (params = {}) => vm.$u.post("/api/farm/mobilelogin", params);//登陆
		 //05
		 arr.addUser = (params = {}) => vm.$u.post("/api/farm/addUser", params);//客户和供应商添加
		 //06
		 arr.weightList = (params = {}) => vm.$u.post("/api/farm/weightList", params);//商品添加页面>>>>>称重商品下拉框数据
		 //07
		 arr.unitList = (params = {}) => vm.$u.post("/api/farm/unitList", params);//商品添加页面>>>>>非称重商品下拉框数据
		 //08
		 arr.kehuAndSchool = (params = {}) => vm.$u.post("/api/farm/kehuAndSchool", params);//商品添加页面>>>>>非称重商品下拉框数据
		 //09
		 arr.addCai = (params = {}) => vm.$u.post("/api/farm/addCai", params);//商品添加页面>>>>>添加商品
		 //10
		 arr.supplierlist = (params = {}) => vm.$u.post("/api/farm/supplierlist", params);//供应商列表
		 //11
		 arr.nolookCai = (params = {}) => vm.$u.post("/api/farm/nolookCai", params);//不可见商品带分页
		 //12
		 arr.orderSubmit = (params = {}) => vm.$u.post("/api/farm/orderSubmit", params);//下单提交
		 //13
		 arr.supplierCaiList = (params = {}) => vm.$u.post("/api/farm/supplierCaiList", params);//供应商全部菜品
		 //14
		 arr.supplierSetCai = (params = {}) => vm.$u.post("/api/farm/supplierSetCai", params);//供应商选则菜品
		 //15
		 arr.supplierCaidingjia = (params = {}) => vm.$u.post("/api/farm/supplierCaidingjia", params);//供应商--基础定价设置
		 //16
		 arr.supplierOwnCaiList = (params = {}) => vm.$u.post("/api/farm/supplierOwnCaiList", params);//供应商自己的不可见商品
	 
	 
	 
	  	 arr.nmCaiList = (params = {}) => vm.$u.post("/api/farm/nmCaiList", params);//农贸 菜品列表  明
	     arr.setNoUserIds = (params = {}) => vm.$u.post("/api/farm/setNoUserIds", params);// 农贸设置 菜品不可见用户 明
	 
	 
	 
	 
	 
	 
	 
	 //arr.login = (params = {}) => vm.$u.post("tblmerchantuser/tbl-merchant-user/login", params);//登录
	 
	 //arr.addGoodInfo = (params = {}) => vm.$u.post("tblmerchantgoods/tbl-merchant-goods/addGoodInfo", params);//添加商品信息
	
	
	
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	
	let api_arr = {};
	for (let key in arr) {
	 if (arr.hasOwnProperty(key)) {
		api_arr[key] = arr[key];
	 }
	}
	
	vm.$u.api = api_arr;
}

export default {
	install
}